W32: Fix listbox selection
authorРуслан Ижбулатов <lrn1986@gmail.com>
Fri, 28 Mar 2014 12:50:51 +0000 (12:50 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Tue, 1 Apr 2014 10:36:49 +0000 (10:36 +0000)
* Makes listbox background white instead of default grey
* Uses gradients or W32 theme parts to draw sexy selection/prelight
  rectangle instead of changing selected/prelighted item background
* Removes blanket button text color, allowing buttons to inherit
  text color from their parents. Non-normal buttons DO get specific
  text color though. This partially fixes text color propagation from
  listbox rows to their children.

https://bugzilla.gnome.org/show_bug.cgi?id=727244

gtk/resources/theme/gtk-win32-base.css
gtk/resources/theme/gtk-win32-xp.css
gtk/resources/theme/gtk-win32.css

index d621178fbfa5ce8b93973b802cd16c207732f70a..5b8b00d203a9a5db972c0dc3759b8bc91b1f180b 100644 (file)
@@ -123,7 +123,6 @@ GtkAssistant .sidebar .highlight {
 /* Buttons */
 
 .button {
-    color: -gtk-win32-color(button, 18);
     background-color: transparent;
     background-image: -gtk-win32-theme-part(button, 1 1);
     border-width: 0;
@@ -143,11 +142,12 @@ GtkAssistant .sidebar .highlight {
 
 .button:prelight, .button:prelight:focused {
     background-image: -gtk-win32-theme-part(button, 1 2);
-    color: #000000;
+    color: @text_color;
 }
 
 .button:active, .button:active:focused, .button:active:focused:prelight {
     background-image: -gtk-win32-theme-part(button, 1 3);
+    color: @text_color;
 }
 
 /* Check buttons */
@@ -858,7 +858,7 @@ column-header .button:active:prelight:focus {
 
 GtkSwitch {
     font: bold condensed 10;
-    color: -gtk-win32-color(button, 18);
+    color: @text_color;
 }
 
 GtkSwitch.slider {
@@ -1326,3 +1326,8 @@ GtkPopover > .view,
 GtkPopover > .toolbar {
     background-color: transparent;
 }
+
+/* Listbox */
+.list {
+  background-color: -gtk-win32-color(listbox, 5);
+}
index ff61e9d97e12ecc7927284fdcb2231dcce36d0a0..68ccba5ef73dc821e1bce48d3fde616c26e5e5b2 100644 (file)
@@ -123,3 +123,42 @@ GtkProgressBar.progressbar {
 .notebook tab:active.left {
     padding: 4px 1px 4px 4px;
 }
+
+/* Listbox */
+
+/* This is roughly similar to what Vista+ theme draws. The reason for using
+this instead of changing background-color to @selection_bg_color is that
+blanket "* { color: @text_color; }" style overrides ".list-row:selected {
+color: @selected_fg_color; }", causing labels and widgets in list rows to have
+black (not white) text over blue background. Fixing that requires overhauling
+the whole theme to put narrow "color: @text_color" style everywhere, to be
+able to remove the blanket style.
+And the reason for not using appropriate W32 theme part is that the appropriate
+W32 theme part does not exist in XP theme. */
+.list-row:prelight {
+    background-image: -gtk-gradient (linear,
+               0 0, 0 1,
+               color-stop(0, rgb(253, 254, 255)),
+               color-stop(1, rgb(237, 245, 255)));
+    box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5);
+}
+
+.list-row:selected {
+  /* Override *:selected {} blanket style, keeping the background - bright
+     and the text - dark */
+    background-color: transparent;
+    color: @text_color;
+    background-image: -gtk-gradient (linear,
+               0 0, 0 1,
+               color-stop(0, rgb(236, 244, 255)),
+               color-stop(1, rgb(208, 230, 255)));
+    box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5);
+}
+
+.list-row:selected:prelight {
+    background-image: -gtk-gradient (linear,
+               0 0, 0 1,
+               color-stop(0, rgb(221, 236, 255)),
+               color-stop(1, rgb(194, 220, 255)));
+    box-shadow: inset -1px -1px 0px rgba (128, 128, 255, 0.5), inset 1px 1px 0px rgba (128, 128, 255, 0.5);
+}
\ No newline at end of file
index f812e4dc66105f332e63532452aedbd158d418b6..ce76a2ba02f87e42ca95cc2c4e182cb8d669c13e 100644 (file)
     /* Make active tab "stick out" left by padding it more at the right */
     padding-right: 4px;
 }
+
+
+/* Listbox */
+
+/* We're cheating here, using part 6 (listview header group),
+   because part 1 (listview item) is empty for some reason */
+.list-row:prelight {
+  background-image: -gtk-win32-theme-part(listview, 6 10);
+}
+
+.list-row:selected {
+  /* Override *:selected {} blanket style, keeping the background - bright
+     and the text - dark */
+  background-color: transparent;
+  color: @text_color;
+  background-image: -gtk-win32-theme-part(listview, 6 11);
+}
+
+.list-row:selected:prelight {
+  background-image: -gtk-win32-theme-part(listview, 6 12);
+}